Skip to content

CFL reachability problem using Kronecker product#10

Open
Mamontyonok wants to merge 3 commits intoSparseLinearAlgebra:stablefrom
Mamontyonok:Kron
Open

CFL reachability problem using Kronecker product#10
Mamontyonok wants to merge 3 commits intoSparseLinearAlgebra:stablefrom
Mamontyonok:Kron

Conversation

@Mamontyonok
Copy link

The basic version of the CFLR algorithm is based on the Kronecker product

Copy link
Member

@gsvgit gsvgit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more explanatory comments. For example look at this request

GrB_Index nvals_old = 0, nvals_new = 0;
GrB_Matrix_nvals(&nvals_old, A);
while (true) {
GrB_mxm(A, NULL, GrB_LOR, GrB_LOR_LAND_SEMIRING_BOOL, A, A, NULL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not ANY_PAIR?

char *msg
)
{
GrB_Matrix M3 = NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming. What is M3?

GrB_Index r_dim = rsm->state_count;
GrB_Index kronecker_dim = r_dim * g_dim;

for (int64_t nt = 0; nt < rsm->nonterminal_count; ++nt) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is hard to realize this loop. We iterate through all non-terminals. Each non-terminal must has related box and this box must has at least one final state. So, it is unclear what exactly we do in this loop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I right, that you just handle boxes where the same state is both final and start?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's it

GrB_Matrix_clear(M3);

for (int64_t t = 0; t < terms_count; ++t) {
GrB_kronecker(M3, NULL, GrB_LOR, GrB_LAND,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not ANY_PAIR?

GrB_Matrix_extractTuples_BOOL(i, j, V, &m3_nvals, M3);

for (GrB_Index k = 0; k < m3_nvals; ++k) {
GrB_Index s = i[k] / g_dim;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming.

GrB_Index x = i[k] % g_dim;
GrB_Index y = j[k] % g_dim;

for (GrB_Index nt = 0; nt < rsm->nonterminal_count; ++nt) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be done using matrix operations like select or reduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants